#include "headfiles.h"

using namespace std;

string convertToTitle(int n) {
    string str;
    int remaining, quotient;
    quotient = n;
    while (quotient > 0) {
        remaining = (quotient - 1) % 26;
        quotient = (quotient - remaining - 1) / 26;
        char c = 'A' + remaining;
        str.push_back(c);
    }

    //reverse the string
    string res;
    for (int i = str.size() - 1; i >= 0; i--) {
        res.push_back(str[i]);
    }
    
    return res;
}

